package com.rightsidetech.trade.mapper;

import com.rightsidetech.trade.dtos.response.*;
import com.rightsidetech.trade.dtos.response.HomeStoreSaleResp;
import com.rightsidetech.trade.entity.TdCommodityOrderDetails;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface TdCommodityOrderDetailsMapper {
    int deleteByPrimaryKey(Long id);

    int deletedByOrderNo(@Param("orderNo") String orderNo);

    int insert(TdCommodityOrderDetails record);

    int insertSelective(TdCommodityOrderDetails record);

    TdCommodityOrderDetails selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(TdCommodityOrderDetails record);

    int updateByPrimaryKey(TdCommodityOrderDetails record);

    List<TdCommodityDetailMallResp> listByOrderNo(@Param("orderNo") String orderNo, @Param("commodityTag") String commodityTag);

    List<TdCommodityAppOrderDetailResp> listAppByOrderNo(@Param("orderNo") String orderNo, @Param("commodityTag") String commodityTag);

    int updateOrderStatusByOrderNo(@Param("orderStatus") Byte orderStatus,@Param("orderNo") String orderNo,@Param("updatedAt") Date updatedAt);

    int updateOrderStatusAndTime(@Param("orderNo") String orderNo);

    List<TdCommodityDetailMallResp> selectAppTagByParentId(@Param("parentId") Long parentId);

    List<TdCommodityOrderDetails> findOrderDetailByOrderNo(@Param("orderNo") String orderNo);

    List<TdCommodityOrderDetails> findOrderDetailByOrderNoAndTag(@Param("orderNo") String orderNo,@Param("tag") Byte tag);

    List<TdCommodityOrderDetails> findOrderDetailByParentIdAndTag(@Param("parentId") Long parentId,@Param("tag") Byte tag);

    Long countByOrderNo(@Param("orderNo") String orderNo);

    Long findSaleById(@Param("areaId") Long areaId,@Param("agentId") Long agentId,@Param("isYesterday") Byte isYesterday);

    List<HomeSpscSaleResp> findTodaySpecSale(@Param("areaId") Long areaId,@Param("agentId") Long agentId);

    List<HomeAgentSaleResp> selectTodayAgentRanking(@Param("areaId") Long areaId);

    List<HomeMonthSaleResp> findMonthSale(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("areaId") Long areaId,@Param("agentId") Long agentId);

    List<HomeStoreSaleResp> listStoreSaleByAgentId(@Param("agentId") Long agentId);

    List<TdCommodityUserOrderZpDetailResp> selectZpDetailByOrderNo(@Param("orderNo") String orderNo);

    int selectZpCountByOrderNo(@Param("orderNo") String orderNo);

    Long selectStatisSalesVolumeCommodityNum(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source);

    Long selectStatisRefundCommodityNum(@Param("statisTime") String statisTime, @Param("storeId") Long storeId, @Param("source") String source);

    List<TdCommodityOrderDetails> detailsByOrder(String orderNo);

    List<String> findCommodityNameByOrderNo(@Param("orderNo") String orderNo);

}